Skip to content

update basic.rst#5

Open
JuwanXu wants to merge 1 commit into
rjl493456442:masterfrom
JuwanXu:master
Open

update basic.rst#5
JuwanXu wants to merge 1 commit into
rjl493456442:masterfrom
JuwanXu:master

Conversation

@JuwanXu

@JuwanXu JuwanXu commented Jul 14, 2020

Copy link
Copy Markdown

No description provided.

Comment thread basic.rst
~~~

leveldb的写操作并不是直接写入磁盘的,而是首先写入到内存。假设写入到内存的数据还未来得及持久化,leveldb进程发生了异常,抑或是宿主机器发生了宕机,会造成用户的写入发生丢失。因此leveldb在写内存之前会首先将所有的写操作写到日志文件中,也就是log文件。当以下异常情况发生时,均可以通过日志文件进行恢复:
leveldb的写操作并不是直接写入内存的,而是首先写入到磁盘。假设写入到内存的数据还未来得及持久化,leveldb进程发生了异常,抑或是宿主机器发生了宕机,会造成用户的写入发生丢失。因此leveldb在写内存之前会首先将所有的写操作写到日志文件中,也就是log文件。当以下异常情况发生时,均可以通过日志文件进行恢复:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢!但是我认为在这里想表达的意思是:

Leveldb的写操作是更新memory db并返回,并不是直接触发一次磁盘写入。

或者我们可以更改为

leveldb在发生写操作时用户数据并不是直接写入磁盘的,而是将其缓存于内存中。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants